<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>函数式组件</title>
    <style>
        header{
            height: 100px;
            background: #aef;
        }
        section{
            height: 400px;
            background: #efa;
        }
        footer{
            height: 100px;
            background: #fae;
        }
    </style>
</head>
<body>
    <div id="root"></div>
    <script src="../js/react.development.js"></script>
    <script src="../js/react-dom.development.js"></script>
    <script src="../js/babel.min.js"></script>

    <script type="text/babel">
        //1. 声明一个函数, 函数名首字母『一定要大写』
        function Toubu(){
            return <header>顶部xxx</header>;
        }

        function Neirong(){
            return <section>内容 xxx</section>;
        }

        function Weibu(){
            return <footer>尾部 xx</footer>;
        }

        function App(){
            return <div>
                {/*2. 使用与函数名同名的『组件标签』   内部会找同名的函数, 并调用函数, 得到虚拟DOM对象 */}
                <Toubu></Toubu>
                <Neirong />
                <Weibu/>
            </div>;
        }
        
        ReactDOM.render(<App />, document.querySelector("#root"));
    </script>
</body>
</html>